#ifndef EDITSCREEN_H
#define EDITSCREEN_H

class QModelIndex;
class QFileSystemModel;
class ProjectManager;
class QTabWidget;
class Highlighter;
class QDir;
class QFileSystemWatcher;
class QPushButton;
class QProcess;
class QPlainTextEdit;
class QSettings;

class ProjectView;
class ErrorList;

#include <QWidget>

class EditScreen : public QWidget {
  Q_OBJECT
public:
  explicit EditScreen(QWidget *parent = 0);

public slots:
  void setProject(const QString);
  void ShowLine(int numLines);
  void ShowFileSelected(const QString& filename);
  void ShowFileSelected(const QModelIndex & index);
  void ShowChangeNote(bool c);
  void ShowFileModifiedNode(const QString & path);
  void CloseTab(int index);
  void CloseAll();
  void SaveFile();
  //project mamager fucntions
  void AddFile();
  void RemoveFile();
  void RenameFile();
  //format current index code editor
  bool Format();
  //debug helper
  void JumpTo(const QString& filename, int line);
  //build project, generate exe file for native app
  bool Build();
  void ShowBuildOutput(int exitCode);
  //run project, read the output, it use the command_process
  void Run();
  void ShowRunOutput();
  void ResetRunButton(int);

private:
  QSettings* s;
  ProjectManager* projectmodel;
  ProjectView* tree;
  QTabWidget* tab;
  QDir* currentPath;
  QFileSystemWatcher* watcher;
  ErrorList* errlist;
  QTabWidget* output_tab;
  QPushButton* bt_toggle_output;
  QPushButton* bt_run;
  QProcess* run_process;
  QProcess* build_process;
  QPlainTextEdit* run_output;
  QPlainTextEdit* build_output;
};

#endif // EDITSCREEN_H
